<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class AdsRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'ads_img' => 'required',
            'ads_title' => 'required',
            'ads_url' => 'required',
            'ads_starttime' => 'required',
            'ads_endtime' => 'required'
        ];
    }
    
    public function messages() {
        return [
            'ads_img.required' => '请上传一张广告图片',
            'ads_title.required' => '广告标题不能为空',
            'ads_url.required' => '广告链接不能为空',
            'ads_starttime.required' => '开始时间不能为空',
            'ads_endtime.required' => '结束时间不能为空',
        ];
    }
}